package com.meichis.yndms.vm;

import androidx.lifecycle.MutableLiveData;

import com.meichis.yndms.model.DataTable;
import com.meichis.yndms.model.SalesRank;
import com.meichis.yndms.repository.manager.SalesRankStaffManager;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xmy
 * @title
 * @remake
 * @create 2021-05-08 15:26
 */
public class VstFeedBackVM extends MyViewModel {
    private MutableLiveData<List<SalesRank>> salesRankList;
    private List<DataTable> dataTableList;
    private MutableLiveData<DataTable> dataTable;


    public MutableLiveData<DataTable> getDataTable() {
        if (dataTable == null) {
            dataTable = new MutableLiveData<>();
            dataTable.setValue(getDataTableList().get(1));
        }
        return dataTable;
    }

    public List<DataTable> getDataTableList() {
        if (dataTableList == null) {
            dataTableList = new ArrayList<>();
            //时间维度：0今日 1昨日 2本周 3本月
            dataTableList.add(new DataTable(1, "昨天"));
            dataTableList.add(new DataTable(3, "本月"));
        }
        return dataTableList;
    }

    public MutableLiveData<List<SalesRank>> getSalesRankList() {
        if (salesRankList == null){
            salesRankList = new MutableLiveData<>();
        }
        return salesRankList;
    }

    public void GetUserSalesRank() {
        SalesRankStaffManager.getInstance().GetUserSalesRank(getShowDialog(), getUserInfo().getValue().getOrgId(), getDataTable().getValue().getValue(), getSalesRankList());
    }

}
